package com.prik.observer.weather.observers;

import com.prik.observer.weather.DisplayElement;
import com.prik.observer.weather.Observer;

/**
 * 布告板
 *
 * @author prik
 * @date 2019/7/17
 */
public class CurrentConditionsDisplay implements Observer, DisplayElement {

    private float temperature;
    private float humidity;
    private float pressure;



    // private Subject weatherData;
    //
    // public CurrentConditionsDisplay(Subject weatherData) {
    //     this.weatherData = weatherData;
    //     weatherData.registerObserver(this);
    // }

    @Override
    public void display() {
        System.out.println("Current conditions:" + temperature + " / " + humidity + " / " + pressure);
    }

    @Override
    public void update(float temperature, float humidity, float pressure) {
        this.temperature = temperature;
        this.humidity = humidity;
        this.pressure = pressure;
        display(); // 暂时写在这儿
    }
}
